package cn.itcast.n4_共享模型_管程;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jol.info.ClassLayout;

/**
 * @program: juc
 * @description:
 * @author: flyduck
 * @create: 2024-09-25 16:09
 **/
@Slf4j(topic = "c.Test10_偏向锁状态_偏向锁是在jvm启动几秒后才生效的")
public class  Test11_偏向锁状态_偏向锁是在jvm启动几秒后才生效的{
    public static void main(String[] args) throws InterruptedException {
        Dog dog1 = new Dog();
        log.debug("jvm启动后新创建对象的mark word:{}",ClassLayout.parseInstance(dog1).toPrintableSimple());//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001

        Thread.sleep(4000);

        Dog dog2 = new Dog();
        log.debug("jvm启动后等待4秒后新创建对象的mark word:{}",ClassLayout.parseInstance(dog2).toPrintableSimple());//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000101
    }
}


